﻿Imports BL.BL


Public Class frmCopiaSeguridad


#Region "Métodos"


    Private Sub frmBackup_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        'combo cantidad de volumenes.
        With Me.cbCantPartes
            .Items.Add(1)
            .Items.Add(2)
            .Items.Add(3)
            .Items.Add(4)
            .SelectedIndex = 0
            .DropDownStyle = ComboBoxStyle.DropDownList
        End With
        Me.txtPathDestino.Clear()

        'patentes del usuario logueado.
        Helper_FL.setearPermisos(frmPrincipal.usr, Me)

    End Sub


    Private Sub Aceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
        Try
            Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
            BackUpRestore_BL.BackUp(Me.txtPathDestino.Text.ToString, CInt(Me.cbCantPartes.SelectedItem))
        Catch ex As Exception
            MsgBox(ex.ToString)
            Exit Sub

        Finally
            Me.Cursor = System.Windows.Forms.Cursors.Default
        End Try
        MessageBox.Show("Se realizó el BACKUP..")
        Me.Close()
        Me.Dispose()
    End Sub


    Private Sub Salir_Click(sender As Object, e As EventArgs) Handles btnSalir.Click
        Me.Close()
        Me.Dispose()
    End Sub


    Private Sub btnSeleccionarPath_Click(sender As Object, e As EventArgs) Handles btnSeleccionarPath.Click
        Me.fbdbackup.ShowDialog()
        Me.txtPathDestino.Text = Me.fbdbackup.SelectedPath
    End Sub


#End Region


#Region "Método Auxiliar"
    'ojo con el keypreview = true, sino foco sobre un textbox o button y no trae la ayuda.
    Private Sub frmCopiaSeguridad_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.F1 Then
            'Application.ExecutablePath '
            Help.ShowHelp(Me, Application.StartupPath & "\ayuda_SEAS.chm", "parte3.htm")
            'Help.ShowHelp(Me, "C:\Users\marcelo\Documents\Visual Studio 2012\Projects\SVN\SEAS\ayuda_SEAS.chm", "parte3.htm")
        End If
    End Sub

#End Region

End Class